{% extends "base.html" %}

{% load i18n %}
{% load humanize %}
{% load btc_formats %}
{% load static %}

{% block title %}
  Decode Raw {{ coin_symbol|coin_symbol_to_display_name }} Hexadecimal Transaction
{% endblock %}

{% block page_header %}
  <h1>
    <i class="fa fa-send"></i> 
    Decode A Transaction
  </h1>
{% endblock page_header %}

{% block content %}

<div class="section">
  <div class="container">

    {% if tx_in_json_str %}
      <h2>Decoded Transaction</h2>

      <pre><small>{{ tx_in_json_str|safe }}</small></pre>

      {% if tx_uri %}
      (This transaction was previously broadcast,
      <a href="{{ tx_uri }}">see it on the blockchain</a>)
      {% endif %}

      <br />
      <h2>Input New Transaction Hex</h2>
    {% endif %}

    <form role="form" method="post" action="{% url 'decode_tx' coin_symbol %}">
      {% load crispy_forms_tags %}
      {{ form|crispy }}
      {% csrf_token %}
      <p class="text-center">
      <button type="submit" class="btn btn-primary btn-lg">
        {% if tx_in_json_str %}
          {% trans "Decode Another Transaction" %}
        {% else %}
          {% trans "Decode Transaction" %}
        {% endif %}
      </button>
      </p>
    </form>

    {% if not tx_uri %}
      <p class="text-center">
        Ready to broadcast?
        <a href="{% url 'push_tx' coin_symbol %}?t={{ tx_hex }}">Click here</a>
        to broadcast a raw transaction hex.
      </p>
    {% endif %}

  </div>
</div>

{% endblock content %}

